import Vue from 'vue'
import Vuex from 'vuex'
import storeUtil from '../src/utils/storeUtil'

Vue.use(Vuex)

let store = new Vuex.Store({
    state: {
        user:{},
        mainActiveView: 0,
        imgIds: [7, 8, 9, 10, 11, 12],
        editPaper: {
            contentList: [

                {type: "text", content: ""},
                {type: "text", content: "《示例图文》"},
                {type: "text", content: "瞬间浪漫的静寂"},
                {
                    type: "img",
                    content: "https://images.unsplash.com/photo-1556909212-d5b604d0c90d?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=60"
                },
                {type: "text", content: "像溶进红茶的方糖"},
                {type: "text", content: "整个身心，都融入在你的声音中"},
            ]

        },

            hotPapers:{
                page:0,
                finished:false,
                loading:false,
                paperList:[]
            },
            newPapers:{
                page:0,
                finished:false,
                loading:false,
                paperList:[]
            }

    },

    mutations: {
        // setMainActiveView(state, mainActiveView) {
        //     if(mainActiveView!=2) state.mainActiveView = mainActiveView//不让中间的按钮激活导致其他按钮变暗
        // }
        ...storeUtil.makeMutations(["user","mainActiveView", "editPaper","hotPapers","newPapers"]),
        setImgIds(state, imgIds) {
            state.imgIds.slice(0, state.imgIds.length);
            state.imgIds.push(imgIds)
        }
    },
    actions: {}
})

storeUtil.setStore(store)

export default store
